package controllers

import (
	"encoding/json"
	"net/http"

	"github.com/gin-gonic/gin"
)

type defaultReq struct {
	Challenge string `json:"challenge"`
	Token     string `json:"token"`
	Type      string `json:"type"`
}

type defaultResp struct {
	Challenge string `json:"challenge"`
}

func Default(ctx *gin.Context) {

	decoder := json.NewDecoder(ctx.Request.Body)
	var req defaultReq
	err := decoder.Decode(&req)
	if err != nil {
		panic(err)
	}

	ctx.JSON(http.StatusOK, defaultResp{
		Challenge: req.Challenge,
	})

	println(req.Challenge)

}
